package com.archgeek.java.biz;

import com.google.common.collect.Collections2;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author pizhihui
 * @date 2023-06-29 18:12
 */
public class FileTest {
    public static void main(String[] args) throws IOException {


        List<String> strings = Files.readAllLines(Paths.get("/Users/pizhihui/ProjectsIdea/code-bigdata/code-00java/src/main/resources/2.txt"));

        Set<String> stringss = new HashSet<>();
        stringss.addAll(strings);

        System.out.println(strings.size() +  "...." + stringss.size());


        Map<String, List<String>> collect = strings.stream().collect(Collectors.groupingBy(x -> x));

        collect.forEach((k,v) -> {
            if (v.size() > 1) {
                System.out.println(k);
            }
        });

    }

}
